package com.easyadmin.modules.oss.controller;

import com.easyadmin.common.web.domain.response.Result;
import com.easyadmin.modules.oss.IOssService;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 功能描述
 *
 * @author Mars.wq [wqexpore@163.com]
 * @version 1.0
 * @date 2023-08-21 10:55:10
 */
@Api(tags = {"文件上传"})
@RestController
@AllArgsConstructor
@RequestMapping("/upload")
public class OssController {

    private final IOssService ossService;


    /**
     * 图片上传
     *
     * @param file file
     * @return String
     */
    @PostMapping("/image")
    private Result upload(@RequestParam(value = "file") MultipartFile file) {
        return Result.success(0, "上传成功", ossService.upload(file));
    }


}
